<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <p id="第三题"></p>

    <form id="from">
        n1 : <input type="text" id="n1" /><br>
        n2: <input type="text" id="n2" /><br>
        <input type="button" Value="乘" />
        <input type="button" Value="除" />
    </form>
        <p>结果 : <br>
        <span id="result"></span>
        </p>
</body>
<script>
function getDateString() {
 let myDate = new Date();
 let a = new Array("日", "一", "二", "三", "四", "五", "六"); 
 let week =myDate.getDay(); 
return  `${'今天是星期'+a[week]}`+","+`${"现在时间是"+myDate.toTimeString()}`

}
console.log(getDateString());
//2
 var triArea=function(a,b,c){
     var s=(a+b+c)/2;
     var area=Math.sqrt(s*(s-a)*(s-b)*(s-c))
     return area;
   }
// triArea(3,4,5)

//3
let c = document.getElementById('c')
var arr;
function loopWord(word) {
  // 提示：用setInterval
 setInterval(function(){
     arr=word.split("");
     arr.unshift(arr[arr.length-1]);
     arr.pop();
     word=arr.join("");
     第三题.innerHTML=word;
 },1000)

}
loopWord('hello world.')
//4
var endTime=new Date(2023,1,1);
var startTime=new Date();
var diffTime=endTime-startTime;
var last=Math.floor(diffTime/1000);
var days=Math.floor(last/3600/24);
console.log(days+"天");

//5
from.onclick=function(e){
    var ele=e.srcElement;
    if(ele.value=="乘"){
       result.innerHTML+=n1.value*n2.value+'<br/>';
    }
    if(ele.value=="除"){
        result.innerHTML+=n1.value/n2.value+'<br/>';
    }
}
//6
function F2C(v){
    return Math.floor(v/5)
}
function C2F(v){
    return Math.floor((v-32)/9)
}

</script>
</html>